// ActionScript file
//
// This method Gets URL Parameters (GUP)
//
import mx.controls.Alert;
import mx.core.Application;


public function gup( name:String ):String
{
  var regexS:String = "[\\?&]"+name+"=([^&#]*)";
  var regex:RegExp = new RegExp( regexS );
  var tmpURL:String = mx.core.Application.application.url;
  //var too:String = mx.core.Application.application.url;
  trace("tmpURL: "+ tmpURL);
  //var tmpURL = window.location.href;
  var results:Array = regex.exec( tmpURL );
  //Alert.show(tmpURL);
  if( results == null )
    return "";
  else
    return results[1];
    
}

//
// This method decodes the query parameters that were URL-encoded
//
public function decode(strToDecode:String):String
{
  var encoded:String = strToDecode;
  return unescape(encoded.replace(/\+/g,  " "));
}